package cn.dnui_xcz826.dnuifood_16110100826.fragments;

import android.support.annotation.Nullable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.content.Intent;

import com.tencent.connect.UserInfo;

import cn.dnui_xcz826.dnuifood_16110100826.R;
import cn.dnui_xcz826.dnuifood_16110100826.controller.MyCommentActivity;
import cn.dnui_xcz826.dnuifood_16110100826.controller.MyOrderActivity;
import cn.dnui_xcz826.dnuifood_16110100826.controller.SettingActivity;
import cn.dnui_xcz826.dnuifood_16110100826.controller.UserImageActivity;
import cn.dnui_xcz826.dnuifood_16110100826.listener.onRetrofitListener;

public class Fragment4 extends BaseFragment implements onRetrofitListener<UserInfo> {
    private ImageView chengse;
    private Button setting,bta,btb;
    private ImageButton touxiang;
    private TextView s_username;

    @Nullable
    @Override//生命周期方法，创建View
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_fragment4,container,false);
    }

    @Override//生命周期方法，View创建完成
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initViews();
        initEvents();
    }

    void initViews(){
        chengse=getView().findViewById(R.id.chengse);
        setting=getView().findViewById(R.id.setting);
        bta=getView().findViewById(R.id.a);
        btb=getView().findViewById(R.id.b);
        s_username=getView().findViewById(R.id.s_username);
        touxiang=getView().findViewById(R.id.touxiang);

        s_username.setText("Username："+getUser_id());


         setting.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                android.content.Intent intent=new Intent(getActivity(),SettingActivity.class);
                startActivity(intent);
            }
        });

         bta.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                android.content.Intent intent=new Intent(getActivity(), MyCommentActivity.class);
                startActivity(intent);
            }
        });

        btb.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                android.content.Intent intent=new Intent(getActivity(),MyOrderActivity.class);
                startActivity(intent);
            }
        });

         touxiang.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                android.content.Intent intent=new Intent(getActivity(),UserImageActivity.class);
                startActivity(intent);
            }
        });

    }

    void initEvents(){

    }

    @Override
    void initData() {

    }


    @Override
    public void onSuccess(UserInfo object, int flag) {

    }

    @Override
    public void onFailure(String msg) {

    }
}
